1. Field of the Invention
The present invention relates to an apparatus and methods for reliably updating firmware or other coded information stored within a nonvolatile memory of a peripheral device.
2. Description of the Related Art
Various types of microcontroller-controlled devices exist which are adapted to communicate with a PC or other type of computer. These devices include, for example, optical drives, magnetic disc drives, hard drives, modems (both internal and external), Personal Digital Assistants (PDAs), solid state memory cards, network interfaces, video cameras, digital cameras, printers, scanners, and fax machines. These and other such devices will be referred to herein as xe2x80x9cperipheral devices,xe2x80x9d and the computer with which the device communicates will be referred to as the xe2x80x9chost computer.xe2x80x9d
Some peripheral devices are capable of receiving firmware modifications or updates from the host computer, such as to eliminate bugs or to add new functions to the device (as used herein, xe2x80x9cfirmware xe2x80x9d refers to the executable code and any associated data used to control the operation of the device). Some peripheral device bus standards, such as Universal Serial Bus (USB), allow a user to unplug and plug (disconnect and connect) a peripheral device, such as a CD-R/W drive, while the host computer is running. In some instances, a user may unintentionally (or intentionally) unplug or disconnect a peripheral device from the peripheral device bus, or turn off the host computer, while the peripheral device is receiving or processing a firmware update from the host computer. This may result in corrupted firmware being stored in the nonvolatile memory of the peripheral device, and can potentially render the device inoperable. In addition, there are other situations, such as a momentary power failure during firmware updates, which may result in incomplete or corrupted firmware.
A CD-R/W drive is a type of peripheral device that is capable of recording and reading data to and from an optical disk. A CD-R/W drive may communicate with a host computer, such as a personal computer (PC), over a peripheral device bus, such as a Universal Serial Bus (USB). As described below, a CD-R/W drive is one type of peripheral device to which the present invention may be applied.
The present invention relates to a system and method for reliably updating and checking firmware stored within a nonvolatile memory of a peripheral device. In accordance with the invention, the nonvolatile memory includes a fixed portion and an updateable portion. The updateable portion stores an updateable version of the basic firmware for the device, and stores a corresponding error detection code (preferably a CRC code) to permit the validity of such firmware to be verified. The fixed portion contains an initialization routine, and includes a default version of the device""s basic firmware
To update the device""s firmware, the host transmits to the device the new version of the updateable firmware together with a corresponding error detection code, and both are stored in the updateable portion in place of the existing firmware and error detection code. When the device is reset, the device""s microcontroller executes the initialization routine to perform an initialization sequence. As part of this sequence, the microcontroller calculates the error detection code for the firmware currently stored in the updateable portion and then compares this value to the error detection code stored in the updateable portion. If a match occurs, the updateable version is deemed valid and is used to control the device; otherwise, the default version stored in the fixed portion is used. In the event of a mismatch, the user may also be notified by sending a message to the host computer and/or by displaying a message on a display of the peripheral device.